package svc

import (
	"api/internal/config"
	"api/internal/middleware"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"user_srv/userclient"
)

type ServiceContext struct {
	Config       config.Config
	AuthTemplate rest.Middleware
	UserSrv      userclient.User
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:       c,
		AuthTemplate: middleware.NewAuthTemplateMiddleware().Handle,
		UserSrv:      userclient.NewUser(zrpc.MustNewClient(c.UserSrv)),
	}
}
